<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button>点击</button>
    <script>
        // function fn(){
        //     console.log(this);
        // }
        // window.fn()

        const btn = document.querySelector('button')
        btn.addEventListener('click', function () {
            // console.log(this);
            // btn.style.color = 'red'  //跟下面效果相同,btn换this
            this.style.color = 'red'  //谁调用,this就是谁

        })
    </script>
</body>

</html>